home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / os2 / nftp072.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1996-06-03  |  6KB  |  194 lines

  1. /* REXX */
  2.  
  3. /* Load RexxUtil extensions */
  4. if RxFuncQuery("SysLoadFuncs") then do
  5.     say "loading RexxUtil extensions..."
  6.     call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  7.     if result \= "0" then do
  8.         say "error loading RexxUtil.dll"
  9.         exit
  10.     end
  11.     call SysLoadFuncs
  12. end
  13.  
  14. /* ask user about directories etc. */
  15. Call SysCls
  16. say
  17. say "NFTP Version 0.72 installation"
  18. say
  19. say "This script will do the following:"
  20. say "1) copy required files into the directory you specified;"
  21. say "2) set up default settings in nftp.ini"
  22. say "3) create two objects on your desktop:"
  23. say "   one for NFTP itself and another for its manual."
  24. say
  25.  
  26. numlangs = 10
  27. lang.1  = "English   "
  28. lang.2  = "Russian   "
  29. lang.3  = "Chinese   "
  30. lang.4  = "Spanish   "
  31. lang.5  = "Swedish   "
  32. lang.6  = "Hungarian " 
  33. lang.7  = "German    "
  34. lang.8  = "Danish    "
  35. lang.9  = "Japanese  "
  36. lang.10 = "Norwegian "
  37. lang.11 = "          "
  38. lang.12 = "          "
  39. lang.13 = "          "
  40. lang.14 = "          "
  41. lang.15 = "          "
  42.  
  43. choose_language:
  44. say "Enter no. of language you wish to install:"
  45. do i = 1 to numlangs by 4
  46.     i1 = i + 1
  47.     i2 = i + 2
  48.     say i")" lang.i "    " i+1")" lang.i1 "    " i+2")" lang.i2
  49. end
  50. parse pull langno .
  51. if langno = "" then exit
  52. if (langno > numlangs) | (langno < 1) then do
  53.     say "The number you entered is outside of range"
  54.     say
  55.     signal choose_language
  56.     end
  57. language = lang.langno
  58.  
  59. say
  60. say "Enter destination directory (where NFTP files will be installed)."
  61. say "If you wish to install NFTP into the subtree (eg, ""d:\apps\tcpip\nftp"")"
  62. say "you have to create upper directory first (""d:\apps\tcpip"" in the"
  63. say "above example)".
  64. parse pull destpath .
  65. if destpath = "" then exit
  66. say
  67. say "Enter default path for downloads (e.g., ""d:\tmp"")."
  68. say "This directory should reside on HPFS drive or you'll be unable"
  69. say "to download files which are not 8.3-compliant."
  70. parse pull dlpath .
  71. if dlpath = "" then exit
  72. say
  73. say "Enter your e-mail address (to be used as a password for anonymous logins):"
  74. parse pull email .
  75. if email = "" then exit
  76.  
  77. destpath = strip(destpath, "T", "\")
  78. dlpath = strip(dlpath, "T", "\")
  79.  
  80. /* verify choices */
  81. say
  82. say copies("-", 75)
  83. say "Installing NFTP into the directory :" destpath
  84. say "NFTP language                      :" language
  85. say "Default download directory is      :" dlpath
  86. say "Your e-mail address                :" email
  87. say
  88. say "Press Ctrl-C to abort or any other key to continue"
  89. say
  90. '@pause >nul'
  91. say
  92.  
  93. /* creating target directories if necessary */
  94. call SysFileTree destpath, "srch", "D"
  95. if srch.0 = 0 then do
  96.     rc = SysMkDir(destpath)
  97.     if rc <> 0 then do
  98.         say "Fatal error: cannot create directory" destpath
  99.         exit
  100.     end
  101. end
  102.  
  103. call SysFileTree dlpath, "srch", "D"
  104. if srch.0 = 0 then do
  105.     rc = SysMkDir(dlpath)
  106.     if rc <> 0 then do
  107.         say "Fatal error: cannot create directory" dlpath
  108.         exit
  109.     end
  110. end
  111.  
  112. /* copying NFTP files */
  113. '@copy nftp.exe'     destpath'\nftp.exe     >nul'
  114. '@copy nftp.ico'     destpath'\nftp.ico     >nul'
  115. '@copy nftp-opt.exe' destpath'\nftp-opt.exe >nul'
  116. '@copy keynames.exe' destpath'\keynames.exe >nul'
  117. '@copy nftp-man.htm' destpath'\nftp-man.htm >nul'
  118. '@copy nftp-man.ps'  destpath'\nftp-man.ps  >nul'
  119. '@copy nftp-man.txt' destpath'\nftp-man.txt >nul'
  120. '@copy nftp-man.ico' destpath'\nftp-man.ico >nul'
  121. '@copy *.dll'        destpath'\ >nul'
  122.  
  123. /* making sure we will not overwrite existing nftp.mrk */
  124. if stream(destpath"\nftp.mrk", "C", "QUERY EXISTS") == "" then
  125.     '@copy nftp.mrk 'destpath'\nftp.mrk >nul'
  126.  
  127. /* checking 'nftp.ini' presence */
  128. newinifile = destpath"\nftp.ini"
  129. if stream(destpath"\nftp.ini", "C", "QUERY EXISTS") <> "" then 
  130. do
  131.     say destpath"\nftp.ini already exists."
  132.     say "File ""nftp.new"" will be created in the" destpath
  133.     say "Please examine it and add new options to your"
  134.     say "existing configuration file"
  135.     newinifile = destpath"\nftp.new"
  136. end
  137. call SysFileDelete newinifile
  138.  
  139. /* creating new 'nftp.ini' and customizing it slightly */
  140. signal off notready
  141. do forever
  142.     lin = linein("nftp.ini")
  143.     newlin = lin
  144.     if left(lin,1) <> ";" then
  145.     do
  146.         if substr(lin,1,19) = 'anonymous-password=' then
  147.             newlin = 'anonymous-password="'email'"'
  148.         if substr(lin,1,19) = 'log-transfers-name=' then
  149.             newlin = 'log-transfers-name="'destpath'\nftp.fls"'
  150.         if substr(lin,1,22) = 'default-download-path=' then
  151.             newlin = 'default-download-path="'dlpath'"'
  152.         if substr(lin,1,15) = 'bookmarks-file=' then
  153.             newlin = 'bookmarks-file="'destpath'\nftp.mrk"'
  154.     end
  155.     rc = lineout(newinifile, newlin)
  156.     if lin = "" & left(stream("nftp.ini"),5) <> "READY" then leave
  157. end
  158. call stream "nftp.ini", "C", "CLOSE"
  159. call stream newinifile, "C", "CLOSE"
  160.  
  161. /* creating nftp.cmd */
  162.  
  163. cmdfile = destpath"\nftp.cmd"
  164. rc = lineout(cmdfile, "@set NFTP_LANG="strip(left(language,7)))
  165. rc = lineout(cmdfile, "@"destpath"\nftp.exe")
  166. call stream cmdfile, "C", "CLOSE"
  167.  
  168. say "Files were copied to" destpath
  169.  
  170. /* creating WPS objects */
  171. say
  172. settings = 'EXENAME='destpath'\nftp.cmd;STARTUPDIR='dlpath';PARAMETERS=[FTP server to log in?];PROGTYPE=WINDOWABLEVIO;NOAUTOCLOSE=YES;MINIMIZED=NO;ICONFILE=nftp.ico'
  173. rc = SysCreateObject('WPProgram', 'NFTP', '<WP_DESKTOP>', settings, 'replace')
  174. if rc != 1 then say "Cannot create program object"
  175. else            say "Program       object was created"
  176. settings = 'EXENAME=explore.exe;PARAMETERS=-q 'destpath'\nftp-man.htm;PROGTYPE=PM;MINIMIZED=NO;ICONFILE=nftp-man.ico'
  177. rc = SysCreateObject('WPProgram', 'NFTP manual', '<WP_DESKTOP>', settings, 'replace')
  178. if rc != 1 then say "Cannot create documentation object"
  179. else            say "Documentation object was created"
  180.  
  181. /* looks like we're done... */
  182. say
  183. say "Installation complete."
  184. say "You can customize "destpath"\nftp.ini according your preferences."
  185. say
  186. say "If you don't have EMX runtime support installed, copy emx.dll into"
  187. say "any directory specified in your LIBPATH. File 'emx.dll' provided"
  188. say "with NFTP version 0.72 has version number ""0.9b, fixlevel 5""."
  189. say "Read NFTP documentation about obtaining complete EMX runtime support"
  190. say "package and its source code."
  191. say
  192. '@pause'
  193. Exit
  194.